home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15917 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.4 KB  |  55 lines

  1. Newsgroups: comp.lang.c++
  2. Path: news.mcs.net!tyfa!paul
  3. From: paul@tyfa.pillar.com
  4. Subject: X-windows notify_proc strangeness.
  5. Message-ID: <1996Apr8.190702.8332@tyfa.pillar.com>
  6. Organization: Tong Yang Futures America, Chicago
  7. Date: Mon, 8 Apr 96 19:07:02 GMT
  8.  
  9. I am having a hard time working C++ into some real time applications using
  10. X-windows and xview. The difficulty arises when I try to define a function
  11. to call at certain intervals. The procedure to set this function is 
  12. notify_set_itimer_func. The problem is that I can not seem to prototype
  13. the notified function in such a way as to make the compiler happy. See
  14. the error below.
  15.  
  16. "main.c", line 216: Error: Formal argument func of type notify_value(*)(...) in call to notify_set_itimer_func(unsigned long, notify_value(*)(...), int, itimerval*, itimerval*) is being passed notify_value(*)().
  17.  
  18.  I have the notified function declared thusly:
  19.  
  20.  Notify_value notified_function();
  21.  
  22.  The notify.h file declares notify_set_itimer_func as:
  23.  
  24. EXTERN_FUNCTION (Notify_func   notify_set_itimer_func, (Notify_client nclient, Notify_func func, int which, struct itimerval *value, struct itimerval *ovalue));
  25.  
  26. This implies that the notified function should be of type Notify_func, not
  27. Notify_value as the XView programming manager would lead one to believe.
  28.  
  29. A quick change to the prototype later :
  30.  
  31. Notify_value notified_function();
  32.  
  33. And on the recompile, I get :
  34.  
  35. "main.c", line 200: Error: Formal argument func of type notify_value(*)(...) in call to notify_set_itimer_func(unsigned long, notify_value(*)(...), int, itimerval*, itimerval*) is being passed notify_value(*)(...)(*)().
  36.  
  37. This makes me think that notified_function should be declared without the 
  38. parentheses. But that would conflict with the declaration of the function's
  39. source code.
  40.  
  41. Notify_value is defined as a pointer to a function of type Notify_func. But
  42. I can not for the life of me find where Notify_func is defined. I think I
  43. might be able to solve the problem if I could find that. 
  44.  
  45. Anyway, has anyone else encountered this problem, or better yet, overcome it?
  46. I would be very grateful for any help you could offer.
  47.  
  48. Thanks,
  49.   Paul
  50. -- 
  51. -----------------------------------------------------------------
  52. | Paul Tomko               | There is no such thing as gravity. |
  53. | paul@tyfa.pillar.com     |       The Earth just sucks.        |
  54. |--------------------------|------------------------------------|
  55.